{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Output widgets: leveraging Jupyter's display system"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import ipywidgets as widgets"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "The `Output` widget can capture and display stdout, stderr and [rich output generated by IPython](http://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#module-IPython.display). You can also append output directly to an output widget, or clear it programmatically."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "out = widgets.Output(layout={'border': '1px solid black'})\n",
    "out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After the widget is created, direct output to it using a context manager. You can print text to the output area:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with out:\n",
    "    for i in range(10):\n",
    "        print(i, 'Hello world!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Rich output can also be directed to the output area. Anything which displays nicely in a Jupyter notebook will also display well in the `Output` widget."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import YouTubeVideo\n",
    "with out:\n",
    "    display(YouTubeVideo('eWzY2nGfkXk'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can even display complex mimetypes, such as nested widgets, in an output widget."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with out:\n",
    "    display(widgets.IntSlider())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can also append outputs to the output widget directly with the convenience methods `append_stdout`, `append_stderr`, or `append_display_data`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "out = widgets.Output(layout={'border': '1px solid black'})\n",
    "out.append_stdout('Output appended with append_stdout')\n",
    "out.append_display_data(YouTubeVideo('eWzY2nGfkXk'))\n",
    "out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that `append_display_data` cannot currently be used to display widgets. The status of this bug is tracked in [this issue](https://github.com/jupyter-widgets/ipywidgets/issues/1811)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can clear the output by either using `IPython.display.clear_output` within the context manager, or we can call the widget's `clear_output` method directly."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "out.clear_output()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`clear_output` supports the keyword argument `wait`. With this set to `True`, the widget contents are not cleared immediately. Instead, they are cleared the next time the widget receives something to display. This can be useful when replacing content in the output widget: it allows for smoother transitions by avoiding a jarring resize of the widget following the call to `clear_output`.\n",
    "\n",
    "Finally, we can use an output widget to capture all the output produced by a function using the `capture` decorator."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "@out.capture()\n",
    "def function_with_captured_output():\n",
    "    print('This goes into the output widget')\n",
    "    raise Exception('As does this')\n",
    "    \n",
    "function_with_captured_output()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`out.capture` supports the keyword argument `clear_output`. Setting this to `True` will clear the output widget every time the function is invoked, so that you only see the output of the last invocation. With `clear_output` set to `True`, you can also pass a `wait=True` argument to only clear the output once new output is available. Of course, you can also manually clear the output any time as well."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "out.clear_output()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Output widgets as the foundation for interact\n",
    "\n",
    "The output widget forms the basis of how interact and related methods are implemented. It can also be used by itself to create rich layouts with widgets and code output. One simple way to customize how an interact UI looks is to use the `interactive_output` function to hook controls up to a function whose output is captured in the returned output widget. In the next example, we stack the controls vertically and then put the output of the function to the right."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = widgets.IntSlider(description='a')\n",
    "b = widgets.IntSlider(description='b')\n",
    "c = widgets.IntSlider(description='c')\n",
    "def f(a, b, c):\n",
    "    print('{}*{}*{}={}'.format(a, b, c, a*b*c))\n",
    "\n",
    "out = widgets.interactive_output(f, {'a': a, 'b': b, 'c': c})\n",
    "\n",
    "widgets.HBox([widgets.VBox([a, b, c]), out])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Debugging errors in callbacks with the output widget\n",
    "\n",
    "On some platforms, like JupyterLab, output generated by widget callbacks (for instance, functions attached to the `.observe` method on widget traits, or to the `.on_click` method on button widgets) are not displayed anywhere. Even on other platforms, it is unclear what cell this output should appear in. This can make debugging errors in callback functions more challenging. \n",
    "\n",
    "An effective tool for accessing the output of widget callbacks is to decorate the callback with an output widget's capture method. You can then display the widget in a new cell to see the callback output."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "debug_view = widgets.Output(layout={'border': '1px solid black'})\n",
    "\n",
    "@debug_view.capture(clear_output=True)\n",
    "def bad_callback(event):\n",
    "    print('This is about to explode')\n",
    "    return 1.0 / 0.0\n",
    "\n",
    "button = widgets.Button(\n",
    "    description='click me to raise an exception',\n",
    "    layout={'width': '300px'}\n",
    ")\n",
    "button.on_click(bad_callback)\n",
    "button"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "debug_view"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Integrating output widgets with the logging module\n",
    "\n",
    "While using the `.capture` decorator works well for understanding and debugging single callbacks, it does not scale to larger applications. Typically, in larger applications, one might use the [logging](https://docs.python.org/3/library/logging.html) module to print information on the status of the program. However, in the case of widget applications, it is unclear where the logging output should go.\n",
    "\n",
    "A useful pattern is to create a custom [handler](https://docs.python.org/3/library/logging.html#handler-objects) that redirects logs to an output widget. The output widget can then be displayed in a new cell to monitor the application while it runs."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import ipywidgets as widgets\n",
    "import logging\n",
    "\n",
    "class OutputWidgetHandler(logging.Handler):\n",
    "    \"\"\" Custom logging handler sending logs to an output widget \"\"\"\n",
    "\n",
    "    def __init__(self, *args, **kwargs):\n",
    "        super(OutputWidgetHandler, self).__init__(*args, **kwargs)\n",
    "        layout = {\n",
    "            'width': '100%', \n",
    "            'height': '160px', \n",
    "            'border': '1px solid black'\n",
    "        }\n",
    "        self.out = widgets.Output(layout=layout)\n",
    "\n",
    "    def emit(self, record):\n",
    "        \"\"\" Overload of logging.Handler method \"\"\"\n",
    "        formatted_record = self.format(record)\n",
    "        new_output = {\n",
    "            'name': 'stdout', \n",
    "            'output_type': 'stream', \n",
    "            'text': formatted_record+'\\n'\n",
    "        }\n",
    "        self.out.outputs = (new_output, ) + self.out.outputs\n",
    "        \n",
    "    def show_logs(self):\n",
    "        \"\"\" Show the logs \"\"\"\n",
    "        display(self.out)\n",
    "    \n",
    "    def clear_logs(self):\n",
    "        \"\"\" Clear the current logs \"\"\"\n",
    "        self.out.clear_output()\n",
    "\n",
    "\n",
    "logger = logging.getLogger(__name__)\n",
    "handler = OutputWidgetHandler()\n",
    "handler.setFormatter(logging.Formatter('%(asctime)s  - [%(levelname)s] %(message)s'))\n",
    "logger.addHandler(handler)\n",
    "logger.setLevel(logging.INFO)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "handler.show_logs()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "handler.clear_logs()\n",
    "logger.info('Starting program')\n",
    "\n",
    "try:\n",
    "    logger.info('About to try something dangerous...')\n",
    "    1.0/0.0\n",
    "except Exception as e:\n",
    "    logger.exception('An error occurred!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## See the documentation for using the `Output` widget to work with threading"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {
     "067590c647ef4381af813a832ac957f4": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {
       "border": "1px solid black"
      }
     },
     "2194b763d5d44bd7bdf3fe386ed3eaf0": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "2af886b9351540bd9d339b6444c4c0e5": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "32f2ae1ff1744e4ebf5aea3e188c7774": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "IntSliderModel",
      "state": {
       "description": "b",
       "layout": "IPY_MODEL_81e818d308b04735b0a7be8e3f4e7f61",
       "style": "IPY_MODEL_879629718b224c37a05f58bae6f1d145"
      }
     },
     "3e7d2d4ad33c4a4a92c26af82a8079c6": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_5a1effa4fbd140939f2959ffc08925b9",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "1 ** some text\n"
        },
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "2 **** some text\n"
        },
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "3 ****** some text\n"
        },
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "4 ******** some text\n"
        },
        {
         "data": {
          "text/html": "<em>All done!</em>",
          "text/plain": "<IPython.core.display.HTML object>"
         },
         "metadata": {},
         "output_type": "display_data"
        }
       ]
      }
     },
     "42f2b3f5056742cbb385d87c5965daf9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "4cd9031ac694476f8be34810fb6a85c0": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_9595fd27deb54240b79a312704d9751b"
      }
     },
     "4e0a980d6db145dd846170a4532f8e66": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "5a1effa4fbd140939f2959ffc08925b9": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "664dce3fede04de69b413545e81a2d68": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "IntSliderModel",
      "state": {
       "description": "c",
       "layout": "IPY_MODEL_4e0a980d6db145dd846170a4532f8e66",
       "style": "IPY_MODEL_b04e215a9e414b1f8bfc0af39c2fa472"
      }
     },
     "670cda42c4464cfab1079a63b18298c2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "ButtonStyleModel",
      "state": {}
     },
     "69704196a2f7415f89547b47b247530f": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "HBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_f5b3c2be494547a181d21595b3f8e202",
        "IPY_MODEL_73061142b6f24d2bacd7be06fd3342b2"
       ],
       "layout": "IPY_MODEL_ccc1b1cfa01d47f582da14067e8007c3"
      }
     },
     "6d04ba48609b46c5bdfd41cbdc41772f": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_a7f2e32c80874da7bc277a860b94e642",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "2018-03-29 21:59:21,537  - [ERROR] An error occurred!\nTraceback (most recent call last):\n  File \"<ipython-input-15-43aa6f6a7e65>\", line 6, in <module>\n    1.0/0.0\nZeroDivisionError: float division by zero\n"
        },
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "2018-03-29 21:59:21,537  - [INFO] About to try something dangerous...\n"
        },
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "2018-03-29 21:59:21,536  - [INFO] Starting program\n"
        }
       ]
      }
     },
     "73061142b6f24d2bacd7be06fd3342b2": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_2194b763d5d44bd7bdf3fe386ed3eaf0",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "0*0*0=0\n"
        }
       ]
      }
     },
     "7e40d1ee1683499fa07dec9ba2f6eaeb": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_067590c647ef4381af813a832ac957f4"
      }
     },
     "81e818d308b04735b0a7be8e3f4e7f61": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "86cf2d818b694152a2546993001d35ac": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "879629718b224c37a05f58bae6f1d145": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "915a9f597ea44249ad35f426642a043e": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "91803a9c53174d6a9a7d68c03ed8e766": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "ButtonModel",
      "state": {
       "description": "click me to raise an exception",
       "layout": "IPY_MODEL_f6b892bd1d4348af95c45f6b851834d5",
       "style": "IPY_MODEL_670cda42c4464cfab1079a63b18298c2"
      }
     },
     "9595fd27deb54240b79a312704d9751b": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {
       "border": "1px solid black"
      }
     },
     "a7f2e32c80874da7bc277a860b94e642": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {
       "border": "1px solid black",
       "height": "160px",
       "width": "100%"
      }
     },
     "b04e215a9e414b1f8bfc0af39c2fa472": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "b71c16133d064ce09bd11a212ee164bb": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_cce9c2d6d14d402eaed457c90afeb1c6",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "0 Hello world!\n1 Hello world!\n2 Hello world!\n3 Hello world!\n4 Hello world!\n5 Hello world!\n6 Hello world!\n7 Hello world!\n8 Hello world!\n9 Hello world!\n"
        },
        {
         "data": {
          "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2MBERISGBUYLxoaL2NCOEJjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2Nj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5QG8ae1y8odrl5QG1j4sO1y8oY62WN32n9g79HS4MeK9aalcl+t1bOmPwx+5zvhAdFYWtPb5eUS6uV8IDbcmWGO7n7S+zKa+Um0kBvzvhGMae1y8odtl5QG3Ji13Vt8IdpfKA2DX2l8odpfKA2DX2l8odpfKA2jV2l8odpfYGxWrtL5Q7S+UBtGrtL5Q7S+UBtGrtL5Q7S+UBtRr7S+x2l9gbPBGHaXyidpfKA2K1dpfZe0vsDYNfaX2O0vsDYNfaX2O0vsDYNfaXyh2l9gbBr7S+x2l9gbBr7S+UO0vsDYNfaX2TtL7A2jX2l9jtL7A2DX2l9jtL7A2DX2l9jtL7A2DX2l9jtL7A2DX2l9jtL7AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//Z\n",
          "text/html": "\n        <iframe\n            width=\"400\"\n            height=\"300\"\n            src=\"https://www.youtube.com/embed/eWzY2nGfkXk\"\n            frameborder=\"0\"\n            allowfullscreen\n        ></iframe>\n        ",
          "text/plain": "<IPython.lib.display.YouTubeVideo at 0x108498c18>"
         },
         "metadata": {},
         "output_type": "display_data"
        },
        {
         "data": {
          "application/vnd.jupyter.widget-view+json": {
           "model_id": "daf3c6e022594b0b98f8fa00d6e43c81",
           "version_major": 2,
           "version_minor": 0
          },
          "text/plain": "IntSlider(value=0)"
         },
         "metadata": {},
         "output_type": "display_data"
        }
       ]
      }
     },
     "ccc1b1cfa01d47f582da14067e8007c3": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "cce9c2d6d14d402eaed457c90afeb1c6": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {
       "border": "1px solid black"
      }
     },
     "daf3c6e022594b0b98f8fa00d6e43c81": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "IntSliderModel",
      "state": {
       "layout": "IPY_MODEL_915a9f597ea44249ad35f426642a043e",
       "style": "IPY_MODEL_42f2b3f5056742cbb385d87c5965daf9"
      }
     },
     "e27ccf08bb8a4861ae3e7ae30b0be913": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "IntSliderModel",
      "state": {
       "description": "a",
       "layout": "IPY_MODEL_86cf2d818b694152a2546993001d35ac",
       "style": "IPY_MODEL_2af886b9351540bd9d339b6444c4c0e5"
      }
     },
     "e4b85a972fb644a6aab6f3dbd83c2b73": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "f5b3c2be494547a181d21595b3f8e202": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "1.2.0",
      "model_name": "VBoxModel",
      "state": {
       "children": [
        "IPY_MODEL_e27ccf08bb8a4861ae3e7ae30b0be913",
        "IPY_MODEL_32f2ae1ff1744e4ebf5aea3e188c7774",
        "IPY_MODEL_664dce3fede04de69b413545e81a2d68"
       ],
       "layout": "IPY_MODEL_e4b85a972fb644a6aab6f3dbd83c2b73"
      }
     },
     "f6b892bd1d4348af95c45f6b851834d5": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "1.0.0",
      "model_name": "LayoutModel",
      "state": {
       "width": "300px"
      }
     }
    },
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
